#ifndef _CONFIG_DATA_H
#define _CONFIG_DATA_H
#include <iostream>
#include <map>
#include <vector>

#define CONFIG_DEFINE( retType, keyType, ClassName)								\
protected: std::map< keyType, retType > m_mapConfig;							\
public: retType* GetById( keyType id)				\
{																				\
    std::map< keyType, retType >::iterator it = m_mapConfig.find( id );			\
    if ( it == m_mapConfig.end() )												\
    {				                                                            \
        return nullptr;     													\
    }																			\
    return it == m_mapConfig.end() ? NULL : &(it->second);						\
}                                                                               \
virtual void ClearData()                                                        \
{                                                                               \
    m_mapConfig.clear();                                                        \
}                                                                               \
public: std::map< keyType, retType >& GetMap()		                            \
{													                            \
    return m_mapConfig;								                            \
}                                                                               \
static const char* GetName()                                                    \
{                                                                               \
    return ClassName;                                                           \
}

class configDataBase
{
public:
    configDataBase(){}
    virtual ~configDataBase(){}
public:
    virtual bool Load(const std::string& fileName)=0;
};

class SkillConfig : public configDataBase
{
public:
    struct STC_CONFIG
    {
        uint32_t dwId;
        std::vector<uint32_t> vecEffects;
        uint32_t dwSkillCD;
        uint32_t dwRange;
        uint32_t dwBaseValue;
        uint32_t dwCostValue;
    };
public:
    bool Load(const std::string& fileName);
    CONFIG_DEFINE(STC_CONFIG,uint32_t,"SkillConfig")
};

#endif